package ${classPath};

<#assign instance="${domain?substring(0,1)?lower_case}${domain?substring(1)}"/>
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension; 

public class ${domain}ServiceTest extends BaseSpringTest{
  @Autowired
  private ${domain}Service ${instance}Service;

  @Test
  public void testCreate() throws Exception { 
    ${domain}AddBo addBo = new ${domain}AddBo();
    addBo.setId(111L);
    <#list fieldList as field>
    <#if field.type="String">
        addBo.set${field.name?cap_first}("${field.name}");//${field.name} ${field.comment}
    <#elseif field.type="Long">
        addBo.set${field.name?cap_first}(10000l);//${field.name} ${field.comment}
    <#elseif field.type="Integer">
        addBo.set${field.name?cap_first}(1000);//${field.name} ${field.comment}
    <#elseif field.type="Double">
        addBo.set${field.name?cap_first}(100d);//${field.name} ${field.comment}
    <#elseif field.type="Amount">
        addBo.set${field.name?cap_first}(new Amount(100));//${field.name} ${field.comment}
    <#elseif field.type="LocalDate">
        addBo.set${field.name?cap_first}(LocalDate.of(2003, 10, 20));//${field.name} ${field.comment}
    <#elseif field.type="LocalDateTime">
        addBo.set${field.name?cap_first}(LocalDateTime.now());//${field.name} ${field.comment}
    <#else>
        addBo.set${field.name?cap_first}(new ${field.type}());//${field.type} ${field.comment}
    </#if>
    </#list>
    ${domain} credit = ${instance}Service.create(addBo);
  }


  @Test
  public void testEdit() throws Exception { 
    ${domain}EditBo editBo = new ${domain}EditBo();
    <#list fieldList as field>
    <#if field.type="String">
        editBo.set${field.name?cap_first}("${field.name}");//${field.name} ${field.comment}
    <#elseif field.type="Long">
        editBo.set${field.name?cap_first}(10000l);//${field.name} ${field.comment}
    <#elseif field.type="Integer">
        editBo.set${field.name?cap_first}(1000);//${field.name} ${field.comment}
    <#elseif field.type="Double">
        editBo.set${field.name?cap_first}(100d);//${field.name} ${field.comment}
    <#elseif field.type="Amount">
        editBo.set${field.name?cap_first}(new Amount(100));//${field.name} ${field.comment}
    <#elseif field.type="LocalDate">
        editBo.set${field.name?cap_first}(LocalDate.of(2003, 10, 20));//${field.name} ${field.comment}
    <#elseif field.type="LocalDateTime">
        editBo.set${field.name?cap_first}(LocalDateTime.now());//${field.name} ${field.comment}
    <#else>
        editBo.set${field.name?cap_first}(new ${field.type}());//${field.type} ${field.comment}
    </#if>
    </#list>
    ${domain} credit = ${instance}Service.edit(10000L, editBo);
  }
}
